import React from 'react';
import styles from './users.css';
import { TransitionGroup, CSSTransition } from "react-transition-group";
import withRouter from 'umi/withRouter';

const BasicLayout: any = withRouter(
    (props) => {
        const transition: any = (
            <TransitionGroup>
                <CSSTransition key={location.pathname} classNames="fade" timeout={2000}>
                    {props.children}
                </CSSTransition>
            </TransitionGroup>
        )
        return props.location.query && props.location.query.from === 'users' ?
            (
                <div className={styles.layout}>
                    <h1 className={styles.title}>This is users!!</h1>
                    {transition}
                </div>
            ) :
            (
                <div>
                    {transition}
                </div>
            )
    }
)

export default BasicLayout;
